#ifndef __BINTERVAL_
#define __BINTERVAL_

#include <algorithm>
#include <cassert>

class BoolInterval {
public:
    BoolInterval(bool a, bool b);
    ~BoolInterval() {}
    bool a() const;
    bool b() const;
    BoolInterval not_() const;
    friend void swap(BoolInterval& a, BoolInterval& b);
    friend bool operator==(const BoolInterval& l, const BoolInterval& r);

private:
    bool a_, b_;
    void assertInvariant() const;

};

inline BoolInterval forceBoolInterval(bool a, bool b) {
  return BoolInterval(a && b, a || b);  // (T,F)也可以变成(F,T)
}

//bool operator==(const BoolInterval& l, const BoolInterval& r);
inline bool operator!=(const BoolInterval& l, const BoolInterval& r) {return !(l == r);}

extern const BoolInterval alltrue;
extern const BoolInterval halftrue;
extern const BoolInterval notrue;

#endif
